package com.example.music.controller;

import com.example.commonutils.R;
import com.example.music.model.request.AdminRequest;
import com.example.music.service.AdminService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpSession;

/**
 * @ClassName AdminController
 * @Author: wx
 * @Create: 2022-10-04  17:12
 * @Description TODO
 * @Version: 1.0
 **/
@RestController
@Api(description = "登录")
@RequestMapping("/admin")
@CrossOrigin //解决跨域问题
public class AdminController {
    @Autowired
    private AdminService adminService;

    // 判断是否登录成功
    @ApiOperation("是否登录成功")
    @PostMapping("/login/status")
    public R loginStatus(@RequestBody AdminRequest adminRequest, HttpSession session) {
        System.out.println(adminRequest.getUsername());
        System.out.println(adminRequest.getPassword());
        return adminService.verityPasswd(adminRequest, session);
    }
}
